add example docs to all datasets and tasks possible#823
Merged
EricSchrock merged 5 commits intomasterfrom Feb 8, 2026
Merged
Conversation
EricSchrock
requested changes
Feb 7, 2026
Collaborator
EricSchrock
left a comment
There was a problem hiding this comment.
Just a couple small items I noticed.
| >>> from pyhealth.tasks import InHospitalMortalityMIMIC4 | ||
| >>> dataset = MIMIC4EHRDataset( | ||
| ... root="/path/to/mimic-iv/2.2", | ||
| ... tables=["diagnoses_icd", "procedures_icd", "labevents"], |
Collaborator
There was a problem hiding this comment.
I don't think this task uses diagnoses_icd or procedures_icd.
Suggested change
| ... tables=["diagnoses_icd", "procedures_icd", "labevents"], | |
| ... tables=["labevents"], |
| samples = [] | ||
| for i in range(len(admissions) - 1): # Skip the last admission since we need a "next" admission | ||
| for i in range( | ||
| len(admissions) - 1 |
Collaborator
There was a problem hiding this comment.
This autoformatting seems a little aggressive. Is this what you're expecting?
Same question throughout this file.
Reduce unnecessary tables. Co-authored-by: Eric Schrock <5274060+EricSchrock@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request primarily adds usage examples to the docstrings of dataset and task classes across the codebase, making it easier for users to understand how to instantiate and use these classes. Additionally, there are minor formatting and code cleanup improvements. The most important changes are grouped below:
Documentation improvements (usage examples):
EHRShotDataset,MIMIC3Dataset,MIMIC4EHRDataset,MIMIC4NoteDataset,MIMIC4CXRDataset, andMIMIC4Datasetto demonstrate typical usage and initialization. [1] [2] [3] [4] [5] [6]BenchmarkEHRShot,BMDHSDiseaseClassification,ChestXray14BinaryClassification,ChestXray14MultilabelClassification,COVID19CXRClassification,DrugRecommendationMIMIC4,InHospitalMortalityMIMIC4,LengthOfStayStageNetMIMIC4, andMIMIC3ICD9Coding. [1] [2] [3] [4] [5] [6] [7] [8] [9]Code formatting and cleanup:
Minor functional changes:
pre_filtermethod ofBenchmarkEHRShotfor filtering OMOP tables.Miscellaneous:
These changes collectively enhance usability, readability, and maintainability of the codebase.